// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   getSqlKey.java

package include.union;


public class getSqlKey
{

	private String dbase;
	private String tableName;
	private String timea;
	private String timeb;
	private String idNumber;
	private String keyword;
	private String fieldName;
	private String fieldName1;
	private String fieldName2;
	private String fieldName3[];
	private String realname;
	private String condition;
	private String queue;
	private String tagq;
	private String sql;
	private String sql1;
	private String sql2;
	private String sql3;
	private String sql4;
	private String sql5;
	private String sql6;
	private String sql7;
	private double tradeTotal;
	private int intValue;
	private double doubleValue;

	public getSqlKey()
	{
		dbase = "";
		tableName = "";
		timea = "";
		timeb = "";
		idNumber = "";
		keyword = "";
		fieldName = "";
		fieldName1 = "";
		fieldName2 = "";
		fieldName3 = new String[1000];
		realname = "";
		condition = "";
		queue = "";
		tagq = "";
		sql = "";
		sql1 = "";
		sql2 = "";
		sql3 = "";
		sql4 = "";
		sql5 = "";
		sql6 = "";
		sql7 = "";
		tradeTotal = 0.0D;
		intValue = 0;
		doubleValue = 0.0D;
	}

	public String query(String dbase, String tName, String uKeyword, String fName3[], String uCondition, String uQueue)
	{
		this.dbase = dbase;
		tableName = tName;
		keyword = uKeyword;
		fieldName3 = fName3;
		condition = uCondition;
		queue = uQueue;
		try
		{
			String key = "";
			int m = 0;
			for (int i = 0; i < fieldName3.length - 1; i++)
			{
				key = (new StringBuilder(String.valueOf(key))).append(tableName).append(".").append(fieldName3[i]).append(" like ").append("'%").append(keyword).append("%'").append(" or ").toString();
				m++;
			}

			key = (new StringBuilder(String.valueOf(key))).append(tableName).append(".").append(fieldName3[m]).append(" like ").append("'%").append(keyword).append("%'").toString();
			if (!key.equals(""))
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where (").append(key).append(") and ").append(condition).append(" ").append(queue).toString();
			else
				sql = (new StringBuilder("select * from ")).append(tableName).append(" where ").append(condition).append(" ").append(queue).toString();
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		return sql;
	}
}
